/*! Jquery style cho trang chi tiet - Trinh Tuan Tai */
$(document).ready(function() {
    var sr_w = screen.availWidth;
    var sr_h = screen.availHeight;
    //var w = $(window).width();
    var h = $(window).height();
    var w = sr_w;
    //var h = (w*996)/1920;
    var rate = w/1920;
    var rate_100 = rate*100;
    var w1 = w*0.05; //mg width
    var w2 = w*0.9; //detail width
    var lh = h*0.125;
    //base detail fix
    $('.wrapper').css({'width':w,'height':h});
    $('.mg_left').css({'width':w1,'height':h});
    $('.detail').css({'width':w2,'height':h});
    $('.logo').css({'height':lh*0.8,'margin-top':lh*0.2,'background-size':'auto '+100+'%'});
    $('.logo h1').css({'padding-left':lh*1.2,'font-size':rate*50+'px'});
    $('.logo h3').css({'padding-left':lh*1.2,'font-size':rate*30+'px'});
    $('.logo .h1').css({'padding-left':lh*1.2,'font-size':rate*50+'px'});
    $('.logo .h3').css({'padding-left':lh*1.2,'font-size':rate*30+'px'});
    $('.nav_detail').css({'width':w1,'height':h});
    $('.nav_detail_icon').css({'width':w1,'height':h});
    $('.nav_detail_icon_item_ps').css({'width':w1*3,'height':lh,'left':w1});
    $('.nav_detail_icon .nav_detail_icon_item_ps a h5').css({'height':lh,'line-height':lh+'px'});
    $('.nav_detail_icon .nav_detail_icon_item a').css({'background-size':'auto '+rate*100*0.4+'%'});
    
    //Show menu item
    $('.nav_detail_icon_item > a').mouseover(function() {
        var t = $(this);
        var p = t.closest('.nav_detail_icon_item');
        var c = p.find('.nav_detail_icon_item_ps');
        c.animate({
            left:-w1*3
        },300,function(){
            
        });
    });
    //Show menu item
    $('.nav_detail_icon_item_ps').mouseover(function() {
        $(this).animate({
            left:-w1*3
        },0,function(){
            
        });
    });
    //Hide menu item
    $('.nav_detail_icon_item > a').mouseout(function() {
        var t = $(this);
        var p = t.closest('.nav_detail_icon_item');
        var c = p.find('.nav_detail_icon_item_ps');
        c.animate({
            left:w1
        },0,function(){
            
        }); 
    });
    //Hide menu item
    $('.nav_detail_icon_item_ps').mouseout(function() {
        $(this).animate({
            left:w1
        },300,function(){
            
        }); 
    });
    
    //share cat page fix
    var w_share_cat_content = w2 -20; // share_cat_content width
    var w_share_cat_item = (w_share_cat_content*0.96)/5; // share_cat_item width
    var h_share_cat_item = w_share_cat_item*1.065; // share_cat_item height
    var m_share_cat_item = (w_share_cat_content*0.04)/5; // margin share_cat_item
    $('.share_cat_item').css({'width':w_share_cat_item,'height':h_share_cat_item,
                                 'margin-right':m_share_cat_item,
                                 'margin-top':m_share_cat_item});
    
    $('.share_detail_item').css({'width':w_share_cat_item,'height':h_share_cat_item,
                                 'margin-right':m_share_cat_item,
                                 'margin-top':m_share_cat_item});
    //Doi tac
    var w_partner_cat_content = w2 -20; // partner_cat_content width
    var w_partner_cat_item = (w_partner_cat_content*0.96)/5; // partner_cat_item width
    var h_partner_cat_item = w_partner_cat_item*0.7; // partner_cat_item height
    var m_partner_cat_item = (w_partner_cat_content*0.04)/5; // margin partner_cat_item
    $('.partner_cat_item').css({'width':w_partner_cat_item,'height':h_partner_cat_item,
                                 'margin-right':m_partner_cat_item,
                                 'margin-top':m_partner_cat_item});
    
    // service cat page fix
    var w_service_cat_content = w2 -20;
    var w_service_cat_item = (w_service_cat_content*0.9)/4;
    var h_service_cat_item = w_service_cat_item*1.18;
    var m_service_cat_item = (w_service_cat_item*0.08);
    var service_cat_item_img = w_service_cat_item*0.42;
    var m_service_cat_item_img = (w_service_cat_item - service_cat_item_img)/2;
    $('.service_item').css({'width':w_service_cat_item,'height':h_service_cat_item,
                                 'margin-right':m_service_cat_item,
                                 'margin-top':m_service_cat_item});
    $('.service_item .img').css({'width':service_cat_item_img,'height':service_cat_item_img,
                                    'margin-left':m_service_cat_item_img,
                                    'margin-top':m_service_cat_item,
                                    'margin-bottom':m_service_cat_item});
    $('.service_item p').css({'margin-top':m_service_cat_item*0.5});
});